package com.viewpager;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.widget.ImageView;

import com.viewpager.customview.MyViewPager;

import butterknife.ButterKnife;

public class MainActivity extends Activity {

    int[] resIds = new int[]{R.drawable.icon01, R.drawable.icon02, R.drawable.icon03,
            R.drawable.icon04, R.drawable.icon05, R.drawable.icon06, R.drawable.icon07};


    private MyViewPager mViewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);//设置无状态栏
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        mViewPager = (MyViewPager) findViewById(R.id.myViewPager);

        for (int i = 0; i < resIds.length; i++) {
            ImageView imageView = new ImageView(this);
            imageView.setBackgroundResource(resIds[i]);
            mViewPager.addView(imageView);
        }
    }

}
